﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
String.prototype.trim=function()
{
     return this.replace(/(^\s*)(\s*$)/g,'');
}
window.onload = function(){
	var oForm1 = document.getElementById('form1');
	oForm1.onsubmit = before_submit;
}
function before_submit(){
	var userName = document.getElementById('userName').value;
	var password = document.getElementById('password').value;
	var passwordConfirm = document.getElementById('passwordConfirm').value;
	if(userName.trim() == ''){
		alert('请输入用户名');
		return false;
	}
	if(password.trim() == ''){
		alert('请输入密码');
		return false;
	}
	if(password != passwordConfirm){
		alert('请确认前后两次输入的密码一致');
		return false;
	}
}
</script>
</head>

<body>
<div style="width:100%; top:100px; position:absolute;">
<div style="margin:0 auto; top:100px; width:400px; height:200px; border:2px solid #333;">
<form action="http://www.miaov.com" method="post" id="form1">
<table width="100%" border="0" cellpadding="2px" cellspacing="0" border="1px">
<thead>
	<tr>
    	<th colspan="2"  style="padding-top:20px;">用户注册</th>
    </tr>
</thead>
	<tr align="center">
    	<td>用户名:</td>
        <td><input id="userName" name="userName"/></td>
    </tr>
    <tr align="center">
    	<td>输入密码:</td>
       	<td><input type="password" id="password" name="password"/></td>
    </tr>
    <tr align="center">
    	<td>确认密码:</td>
       	<td><input type="password" id="passwordConfirm" name="passwordConfirm"/></td>
    </tr>
    <tr align="center">
    	<td colspan="2"><input type="submit"/></td>
    </tr>
</table>
</form>
</div>
</div>
</body>
</html>
